/**
 * File: Flavor.java
 * Author: Eliana Feasley and Mark pallone
 * Emails: elf4@umbc.edu , markpa1@umbc.edu
 * Date: Jun 19, 2011
 * 
 * Description: Any flavor - "Mint Chocolate Chip", "Vanilla", etc.
 */
package model;

/**
 * @author mark
 *
 */
public class Flavor {
	/**
	 * eg, "Soft Served"
	 */
	private String type;
	
	/**
	 * eg, "Chocolate"
	 */
	private String name;
	
	private double price;
	private double weightPerServing;
	
	/**
	 * 
	 * Flavor - Create an object.
	 * Preconditions: price must be zero or positive
	 * Postconditions: a Flavor will be created
	 * @param type eg, "Soft Served"
	 * @param name eg, "Chocolate"
	 * @param price the price
	 * @param weightPerServing the weight per serving/scoop/whatever
	 */
	public Flavor(String type, String name, double price, double weightPerServing) {
		this.setType(type);
		this.setName(name);
		this.setPrice(price);
		this.setWeightPerServing(weightPerServing);
	}
	
	/**
	 * toString - get a String representation of this object
	 * preconditions: none
	 * postconditions: none
	 * @return String representation of this object
	 */
	public String toString() {
		//return name + " " + type;
		return name;
	}

	/**
	 * setType - set type
	 * Preconditions: none
	 * Postconditions: the type will be returned
	 * @param type the type to set
	 */
	public void setType(String type) {
		this.type = type;
	}

	/**
	 * getType - get the type
	 * Preconditions: none
	 * Postconditions: the type will be returned
	 * @return the type
	 */
	public String getType() {
		return type;
	}

	/**
	 * setName - set name
	 * Preconditions: none
	 * Postconditions: the name will be returned
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * getName - get the name
	 * Preconditions: none
	 * Postconditions: the name will be returned
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * setPrice - set price
	 * Preconditions: price must be zero or positive
	 * Postconditions: the price will be returned
	 * @param price the price to set
	 */
	public void setPrice(double price) {
		if (price >= 0) {
			this.price = price;
		} else {
			this.price = 0.0;
		}
	}

	/**
	 * getPrice - get the price
	 * Preconditions: none
	 * Postconditions: the price will be returned
	 * @return the price
	 */
	public double getPrice() {
		return price;
	}

	/**
	 * setWeightPerServing - set weightPerServing
	 * Preconditions: none
	 * Postconditions: the weightPerServing will be returned
	 * @param weightPerServing the weightPerServing to set
	 */
	public void setWeightPerServing(double weightPerServing) {
		this.weightPerServing = weightPerServing;
	}

	/**
	 * getWeightPerServing - get the weightPerServing
	 * Preconditions: none
	 * Postconditions: the weightPerServing will be returned
	 * @return the weightPerServing
	 */
	public double getWeightPerServing() {
		return weightPerServing;
	}
}
